python open pickle file

39

with open('filename', 'rb') as f:
    x = pickle.load(f)
with open('mypickle.pickle', 'wb') as f:
    pickle.dump(some_obj, f)

# note that this will overwrite any existing file
# in the current working directory called 'mypickle.pickle'
pickle_in = open("dict.pickle","rb")
example_dict = pickle.load(pickle_in)
import pickle


with open('serialized.pkl', 'rb') as f:
    data = pickle.load(f)

Comments

Submit
0 Comments